class LocaltypesController < ApplicationController
  # GET /localtypes
  # GET /localtypes.xml
  def index
    @localtypes = Localtype.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @localtypes }
    end
  end

  # GET /localtypes/1
  # GET /localtypes/1.xml
  def show
    @localtype = Localtype.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @localtype }
    end
  end

  # GET /localtypes/new
  # GET /localtypes/new.xml
  def new
    @localtype = Localtype.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @localtype }
    end
  end

  # GET /localtypes/1/edit
  def edit
    @localtype = Localtype.find(params[:id])
  end

  # POST /localtypes
  # POST /localtypes.xml
  def create
    @localtype = Localtype.new(params[:localtype])

    @localtype = modifica @localtype,params[:localtype]

    respond_to do |format|
      if @localtype.save
        flash[:notice] = 'Localtype was successfully created.'
        format.html { redirect_to(localtypes_url) }
        format.xml  { render :xml => @localtype, :status => :created, :location => @localtype }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @localtype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /localtypes/1
  # PUT /localtypes/1.xml
  def update
    @localtype = Localtype.find(params[:id])

    respond_to do |format|
      if @localtype.update_attributes(params[:localtype])
        flash[:notice] = 'Localtype was successfully updated.'
        format.html { redirect_to(localtypes_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @localtype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /localtypes/1
  # DELETE /localtypes/1.xml
  def destroy
    @localtype = Localtype.find(params[:id])
    @localtype.destroy

    respond_to do |format|
      format.html { redirect_to(localtypes_url) }
      format.xml  { head :ok }
    end
  end
end
